package com.zerui.manager.app.accessauthorg.executer;

import com.alibaba.cola.catchlog.CatchAndLog;
import com.zerui.basedata.client.OrganizationService;
import com.zerui.basedata.client.cmd.OrganizationQueryListCmd;
import com.zerui.basedata.client.dto.OrganizationTreeDTO;
import com.zerui.cola.dto.SingleResponse;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Component;
import java.util.List;

/**
 * @Author wh
 * @create_time 2023-08-29 16:35
 */
@Component
@CatchAndLog
public class AccessAuthOrgQryTreeCmdExe {

    @DubboReference
    private OrganizationService organizationService;

    public SingleResponse<List<OrganizationTreeDTO>> execute(String orgName) {
        OrganizationQueryListCmd cmd = new OrganizationQueryListCmd();
        cmd.setOrgName(orgName);
        cmd.setBizType("department");
        cmd.setIsTree(true);
        return organizationService.listOrganization(cmd);
    }
}
